package io.reader;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;

//为什么要存在字符流
//字节流是对字节数据进行操作,而字符流存在的意义就是为了方便操作中文
public class ReaderDemo {

    //入口
    public static void main(String[] args) throws IOException {
        //使用字节流读取数据

        //创建一个字节输入流对象
        FileInputStream fileInputStream = new FileInputStream("Day10\\src\\io\\reader\\Test.txt");

        //读取数据
        byte [] bytes = new byte[3];

        int read = fileInputStream.read();
        bytes[0]=(byte)read;

        int read2= fileInputStream.read();
        bytes[1]=(byte)read2;

        int read3= fileInputStream.read();
        bytes[2]=(byte)read3;

        //把字节数组转化成字符串
        String s = new String(bytes);
        System.out.println(s);


        //释放资源
        fileInputStream.close();





    }
}
